package demo10_1;

public class Test10_1 {
    public static void test1(Animal animal) {
        animal.eat();
    }
    public static void test2(IRunning iRunning) {
        iRunning.run();
    }
    public static void test3(ISwimming iSwimming) {
        iSwimming.swim();
    }
    public static void test4(IFlying iFlying) {
        iFlying.fly();
    }
    public static void main(String[] args) {
//        Dog dog = new Dog("小狗",2);
//        Bird bird = new Bird("小鸟",1);
//        test1(bird);
//        test1(dog);
//        System.out.println("==========================");
//        //dog和bird都实现了IRunning
//        test2(bird);
//        test2(dog);
//        System.out.println("==========================");
//        //只有dog实现了ISwimming
//        test3(dog);
//        System.out.println("==========================");
//        //只有bird实现了IFlying
//        test4(bird);
//        System.out.println("==========================");
        test2(new Robot());
    }
}
